﻿<?php
class UserView {
	public function __construct() {}
	
	public function getLoginDiv() {
		return '<table class="loginTable"><tbody>
			<tr>
				<td>Username</td>
				<td>Password</td>
			</tr>
			<tr>
				<td><input type="text" id="username_input" /></td>
				<td><input type="password" id="password_input" /></td>
			</tr>
		</tbody></table>
		<button type="button" id="login_button">Login</button>
		<button type="button" onclick="goToRegisterURL();">Register</button>
		<script type="text/javascript">
			function goToRegisterURL() {window.location = "./register.php";};
		
			$(document).ready(function() {
				$("#login_button").click(function() {
					login($("#username_input").val(), SHA1($("#password_input").val()));
				});
				$("#register_button").click(function() {
					showRegisterUserMenu();
				});
			});
		</script>';
	}
	
	public function getUserLoggedDiv($username) {
		return $username . 
				' <button type="button" onclick="viewMyPlaylists()">My Playlists</button>
				<button type="button" onclick="viewMyFavorites()">My Favorites</button>
				<button type="button" onclick="logout()">Logout</button>
				<script type="text/javascript">
				</script>';
	}
}
?>